package model

type SystemSmsLogSendType int

const (
	SystemSmsLogSendTypeTime = SystemSmsLogSendType(1) // 定时发送
)

type SystemSmsLogStatus int

const (
	SystemSmsLogStatusPending  = SystemSmsLogStatus(1) // 待发送
	SystemSmsLogStatusSending  = SystemSmsLogStatus(2) // 发送中
	SystemSmsLogStatusSuccess  = SystemSmsLogStatus(3) // 发送成功
	SystemSmsLogStatusFailed   = SystemSmsLogStatus(4) // 发送失败
	SystemSmsLogStatusCanceled = SystemSmsLogStatus(5) // 已取消
)

//go:generate go run ../cmd/generate dao --table system_sms_logs

type SystemSmsLog struct {
	Model

	SendType       *SystemSmsLogSendType `gorm:"type:uint;not null;default:1"`               // 发送类型
	SendTime       *int64                `gorm:"type:uint;not null;default:0"`               // 发送时间
	Provider       *string               `gorm:"type:string;size:64;not null"`               // 服务提供商名称
	Telephone      *string               `gorm:"type:string;size:64;not null"`               // 手机号
	TemplateCode   *string               `gorm:"type:string;size:64;not null"`               // 模板代码
	TemplateParams *string               `gorm:"type:string;size:255;not null;default:'{}'"` // 模板参数，JSON字符串
	Status         *SystemSmsLogStatus   `gorm:"type:uint;not null;default:1"`               // 状态
	FailedReason   *string               `gorm:"type:string;size:2000;not null;default:''"`  // 失败原因
	CompleteTime   *int64                `gorm:"type:uint;not null;default:0"`               // 完成时间
}

func (cls *SystemSmsLog) TableName() string {
	return "system_sms_logs"
}
